<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增电池箱')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-pack-add">
            <div class="form-group">
                <label class="col-sm-3 control-label">电池包编码：</label>
                <div class="col-sm-8">
                    <input name="baoCoding" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">电池包型号名称：</label>
                <div class="col-sm-8">
                    <input name="baoModelName" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">电池包型号编号：</label>
                <div class="col-sm-8">
                    <input name="baoModelId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">实际容量：</label>
                <div class="col-sm-8">
                    <input name="baoCapacity" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">实际电压(V)：</label>
                <div class="col-sm-8">
                    <input name="baoTensioin" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">实际质量(kg)：</label>
                <div class="col-sm-8">
                    <input name="baoQuality" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">出厂时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="leaveFactoryTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">所在车辆VIN：</label>
                <div class="col-sm-8">
                    <select name="vin" class="form-control" type="text">

                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">电池包规格代码：</label>
                <div class="col-sm-8">
                    <input name="daoSpecification" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">电池品牌：</label>
                <div class="col-sm-8">
                    <input name="batteryBrand" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">模块串并联方式：</label>
                <div class="col-sm-8">
                    <input name="moduleUntieWay" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">模块个数：</label>
                <div class="col-sm-8">
                    <input name="moduleNums" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">生产厂商名称：</label>
                <div class="col-sm-8">
                    <input name="manufacturerName" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">模块型号：</label>
                <div class="col-sm-8">
                    <input name="moduleIds" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">电池包型号性能参数：</label>
                <div class="col-sm-8">
                    <select name="argumentId" class="form-control" type="text"></select>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "part/batterypack"
        $("#form-pack-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            alert($('#form-pack-add').vin);
            console.log($('#form-pack-add').serialize());
            if ($.validate.form()) {
                console.log($('#form-pack-add').serialize());
                $.operate.save(prefix + "/add", $('#form-pack-add').serialize());
            }
        }

        $("input[name='leaveFactoryTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
        $(function () {
            $.ajax({
                url:"/carmain/carmain/findAll",
                type:"get",
                dataType:"json",
                success:function (n) {
                   for (var i in n){
                       $("[name='vin']").append("<option value="+n[i].id+">"+n[i].vin+"</option>");
                   }
                }
            })
            $.ajax({
                url:"/pack/information/findAll",
                type:"get",
                dataType:"json",
                success:function (n) {
                    for (var i in n){
                        $("[name='argumentId']").append("<option value="+n[i].id+">标准"+i+"</option>");
                    }
                }
            })
        })
    </script>
</body>
</html>
